package internal

type Content struct {
	CentralTopic string `json:"centralTopic,omitempty"`
}

type Extensions struct {
	Provider string  `json:"provider,omitempty"`
	Content  Content `json:"content,omitempty"`
}

type RootElement struct {
	ID               string       `json:"id,omitempty"`
	RevisionID       string       `json:"revisionId,omitempty"`
	Class            string       `json:"class,omitempty"`
	RootTopic        Node         `json:"rootTopic,omitempty"`
	Title            string       `json:"title,omitempty"`
	TopicOverlapping string       `json:"topicOverlapping,omitempty"`
	Extensions       []Extensions `json:"extensions,omitempty"`
	Style            interface{}  `json:"style,omitempty"`
	Theme            interface{}  `json:"theme,omitempty"`
}

type Children struct {
	Attached []Node `json:"attached,omitempty"`
}
type Node struct {
	ID             string   `json:"id"`
	Class          string   `json:"class,omitempty"`
	Title          string   `json:"title"`
	TitleUnedited  bool     `json:"titleUnedited"`
	StructureClass string   `json:"structureClass,omitempty"`
	Children       Children `json:"children,omitempty"`
	Style          struct {
		ID         string `json:"id"`
		Properties struct {
			Alignment_by_level  string `json:"alignment-by-level,omitempty"`
			Arrow_end_class     string `json:"arrow-end-class,omitempty"`
			Border_line_color   string `json:"border-line-color,omitempty"`
			Border_line_pattern string `json:"border-line-pattern,omitempty"`
			Border_line_width   string `json:"border-line-width,omitempty"`
			Fill_pattern        string `json:"fill-pattern,omitempty"`
			Fo_color            string `json:"fo:color,omitempty"`
			Fo_font_family      string `json:"fo:font-family,omitempty"`
			Fo_font_size        string `json:"fo:font-size,omitempty"`
			Fo_font_style       string `json:"fo:font-style,omitempty"`
			Fo_font_weight      string `json:"fo:font-weight,omitempty"`
			Fo_text_align       string `json:"fo:text-align,omitempty"`
			Fo_text_decoration  string `json:"fo:text-decoration,omitempty"`
			Fo_text_transform   string `json:"fo:text-transform,omitempty"`
			Line_class          string `json:"line-class,omitempty"`
			Line_color          string `json:"line-color,omitempty"`
			Line_pattern        string `json:"line-pattern,omitempty"`
			Line_width          string `json:"line-width,omitempty"`
			Shape_class         string `json:"shape-class,omitempty"`
			Svg_fill            string `json:"svg:fill,omitempty"`
		} `json:"properties"`
	} `json:"style"`
}

// countDescendants recursively counts the number of descendants for a given node
// func CountDescendants(node Node) int {
// 	count := 0
// 	for _, child := range node.Children.Attached {
// 		count++
// 		count += CountDescendants(child)
// 	}
// 	return count
// }

// updateTitle updates the node's title to include the descendant count
// func UpdateTitle(node *Node) {
// 	descendantCount := CountDescendants(*node)
// 	node.Title = fmt.Sprintf("%s(%d)", node.Title, descendantCount)

// 	fmt.Printf("%s\n", node.Title)

// 	for i := range node.Children.Attached {
// 		UpdateTitle(&node.Children.Attached[i])
// 	}
// }
